<template>
  <div>
    <div style="margin: 10px 0">
      <el-card shadow="always">
        <el-form  :model="dictionarySearch" :inline="true"  style="margin-bottom: 5px">
          <el-form-item label="类型：">
            <el-input placeholder="类型(不区分大小写)" :rows="1" type="text" style="width:200px" v-model="dictionarySearch.dictionaryTypeEncoded"></el-input>
          </el-form-item>
          <el-form-item label="字典类型：">
            <el-select placeholder="字典类型" v-model="dictionarySearch.dictionaryTypeId">
              <el-option v-for="item in dictionaryTypeList" :key="item.id" :label="item.dictionaryTypeName" :value="item.id"> </el-option>
            </el-select>
          </el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="search"  >搜索</el-button>
          <el-button icon="el-icon-delete" @click="resetting" style="color: #d7000f; border: 1px solid #d7000f" >重置</el-button>
        </el-form>
      </el-card>
    </div>

    <div style="margin: 10px 0">
      <el-card shadow="always" style="margin-top: 30px">
        <div style="margin: 10px 0">
          <el-button icon="el-icon-plus" type="primary" @click="addDictionary=true">新增</el-button>
          <el-button icon="el-icon-refresh-right" type="primary" @click="dictionarySelectAll">缓存</el-button>
        </div>
        <el-table :data="dictionaryList" stripe border style="width:100%" >
          <el-table-column type="index" label="序号" width="100" align="center"> </el-table-column>
          <el-table-column prop="dictionaryTypeEncoded" label="类型" width="200" align="center"> </el-table-column>
          <el-table-column prop="dictionaryDescribe" label="描述" width="200" align="center"> </el-table-column>
          <el-table-column prop="dictionaryTypeName" label="字典类型" width="200" align="center"> </el-table-column>
          <el-table-column prop="dictionaryRemarks" label="备注消息" width="200" align="center"> </el-table-column>
          <el-table-column prop="dictionaryCreateTime" label="创建时间" width="250" align="center"> </el-table-column>
          <el-table-column prop="address" fixed="right" label="操作"  align="center" width="350">
            <template slot-scope="scope">
              <el-button icon="el-icon-edit" @click="openUpdate(scope.row)" style="background-color: #534947; color: #fff" >编辑</el-button>&nbsp
              <el-button  @click="open(scope.row)" style="background-color: #d7000f; color: #fff" >删除</el-button>&nbsp
              <el-button icon="el-icon-menu" @click="dictionaryEntriesSelectAll(scope.row)">字典项</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div style="margin: 10px 0">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="page.pageNum"
                         :page-sizes="[5, 10, 15, 20]" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="page.total"
                         style="float:right;margin-right: 40%;margin-top: 30px;margin-bottom:30px;">
          </el-pagination>
        </div>
      </el-card>
    </div>
    <div style="margin: 10px 0">
      <!--修改字典弹窗-->
      <el-dialog title="修改字典" :visible.sync="update" >
        <el-form :model="updateDictionary" ref="updateDictionary" :rules="rules" label-width="100px" style="text-align: left" class="demo-ruleForm">
          <el-form-item label="类型" style="display: inline-block; vertical-align: middle" prop="dictionaryTypeEncoded">
            <el-input v-model="updateDictionary.dictionaryTypeEncoded" ></el-input>
          </el-form-item>
          <el-form-item label="描述" style="display: inline-block; vertical-align: middle" prop="dictionaryDescribe">
            <el-input v-model="updateDictionary.dictionaryDescribe" ></el-input>
          </el-form-item>
          <el-form-item label="字典类型" style="display: inline-block; vertical-align: middle" prop="dictionaryTypeId">
            <el-select v-model="updateDictionary.dictionaryTypeId" placeholder="字典类型" style="width: 200px">
              <el-option v-for="item in dictionaryTypeList" :key="item.id" :label="item.dictionaryTypeName" :value="item.id"> </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="备注消息" style="display: inline-block; vertical-align: middle">
            <el-input v-model="updateDictionary.dictionaryRemarks" ></el-input>
          </el-form-item>
          <el-form-item label="创建时间" style="display: inline-block; vertical-align: middle">
            <el-input prefix-icon="el-icon-date" v-model="updateDictionary.dictionaryCreateTime" :disabled="true"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="emptyUpdate">取 消</el-button>
          <el-button type="primary" @click="dictionaryUpdate">确 定</el-button>
        </div>
      </el-dialog>
      <!--新增字典弹窗-->
      <el-dialog title="新增字典" :visible.sync="addDictionary">
        <el-form :model="insertDictionary" ref="insertDictionary" :rules="rules" label-width="100px" style="text-align: left" class="demo-ruleForm">
          <el-form-item label="类型" style="display: inline-block; vertical-align: middle" prop="dictionaryTypeEncoded">
            <el-input v-model="insertDictionary.dictionaryTypeEncoded" ></el-input>
          </el-form-item>
          <el-form-item label="描述" style="display: inline-block; vertical-align: middle" prop="dictionaryDescribe">
            <el-input v-model="insertDictionary.dictionaryDescribe" ></el-input>
          </el-form-item>
          <el-form-item label="字典类型" style="display: inline-block; vertical-align: middle" prop="dictionaryTypeId">
            <el-select v-model="insertDictionary.dictionaryTypeId" placeholder="字典类型" style="width: 200px">
              <el-option v-for="item in dictionaryTypeList" :key="item.id" :label="item.dictionaryTypeName" :value="item.id"> </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="备注消息" style="display: inline-block; vertical-align: middle">
            <el-input v-model="insertDictionary.dictionaryRemarks" ></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="emptyDictionary">取 消</el-button>
          <el-button type="primary" @click="dictionaryInsert">确 定</el-button>
        </div>
      </el-dialog>
      <!--字典项-->
      <el-dialog title="字典项" :visible.sync="dictionaryEntries" width="1200px" v-if="screen==1">
        <div style="margin: 10px 0">
          <el-card shadow="always" style="margin-top: 30px">
            <div style="margin: 10px 0">
              <el-button icon="el-icon-plus" type="primary" @click="addDictionaryEntries=true">新增</el-button>
              <el-button icon="el-icon-refresh-right" type="primary" @click="dictionaryEntriesSelectAll1">缓存</el-button>
              <el-button icon="el-icon-full-screen" type="primary" v-if="screen==1" @click="screen=0">全屏</el-button>
              <el-button icon="el-icon-full-screen" type="primary" v-if="screen==0" @click="screen=1">取消全屏</el-button>
            </div>
            <div>
              <el-table :data="dictionaryEntriesList" stripe border style="width:100%" >
                <el-table-column type="index" label="序号" width="100" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesTypeEncoded" label="类型" width="200" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesPrice" label="数据值" width="200" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesName" label="标签名" width="200" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesDescribe" label="描述" width="200" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesSort" label="排序" width="200" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesTypeName" label="数据类型" width="200" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesRemarks" label="备注消息" width="200" align="center"> </el-table-column>
                <el-table-column prop="address" label="操作" fixed="right" align="center" width="250">
                  <template slot-scope="scope">
                    <el-button icon="el-icon-edit" @click="openUpdate(scope.row)" style="background-color: #534947; color: #fff" >编辑</el-button>&nbsp
                    <el-button icon="el-icon-delete" @click="open(scope.row)" style="background-color: #d7000f; color: #fff">删除</el-button>&nbsp
                  </template>
                </el-table-column>
              </el-table>
              <div class="el-dialog-div">
                <el-pagination @size-change="handleSizeChange1" @current-change="handleCurrentChange1" :current-page.sync="page1.pageNum"
                               :page-sizes="[5, 10, 15, 20]" :page-size="page1.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="page1.total"
                               style="float:right;margin-right: 40%;margin-top: 30px;margin-bottom:30px;">
                </el-pagination>
              </div>
            </div>
          </el-card>
        </div>
      </el-dialog>
      <el-dialog title="字典项" :visible.sync="dictionaryEntries" width="1200px" v-if="screen==0" fullscreen>
        <div style="margin: 10px 0">
          <el-card shadow="always" style="margin-top: 30px">
            <div style="margin: 10px 0">
              <el-button icon="el-icon-plus" type="primary" @click="addDictionaryEntries=true">新增</el-button>
              <el-button icon="el-icon-refresh-right" type="primary" @click="dictionaryEntriesSelectAll1">缓存</el-button>
              <el-button icon="el-icon-full-screen" type="primary" v-if="screen==0" @click="screen=1">取消全屏</el-button>
            </div>
            <div>
              <el-table :data="dictionaryEntriesList" stripe border style="width:100%" >
                <el-table-column type="index" label="序号" width="100" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesTypeEncoded" label="类型" width="200" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesPrice" label="数据值" width="200" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesName" label="标签名" width="200" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesDescribe" label="描述" width="200" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesSort" label="排序" width="200" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesTypeName" label="数据类型" width="200" align="center"> </el-table-column>
                <el-table-column prop="dictionaryEntriesRemarks" label="备注消息" width="200" align="center"> </el-table-column>
                <el-table-column prop="address" label="操作" fixed="right" align="center" width="320">
                  <template slot-scope="scope">
                    <el-button icon="el-icon-edit" @click="openUpdate(scope.row)" style="background-color: #534947; color: #fff" >编辑</el-button>&nbsp
                    <el-button icon="el-icon-delete" @click="open(scope.row)" style="background-color: #d7000f; color: #fff">删除</el-button>&nbsp
                  </template>
                </el-table-column>
              </el-table>
              <div class="el-dialog-div">
                <el-pagination @size-change="handleSizeChange1" @current-change="handleCurrentChange1" :current-page.sync="page1.pageNum"
                               :page-sizes="[5, 10, 15, 20]" :page-size="page1.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="page1.total"
                               style="float:right;margin-right: 40%;margin-top: 30px;margin-bottom:30px;">
                </el-pagination>
              </div>
            </div>
          </el-card>
        </div>
      </el-dialog>
      <!--新增字典项-->
      <el-dialog title="新增字典项" :visible.sync="addDictionaryEntries">
        <el-form :model="insertDictionaryEntries" ref="insertDictionaryEntries" :rules="rules" label-width="100px" style="text-align: left" class="demo-ruleForm">
          <el-form-item label="类型:" style="display: inline-block; vertical-align: middle" prop="dictionaryEntriesTypeEncoded">
            <el-input v-model="insertDictionaryEntries.dictionaryEntriesTypeEncoded" ></el-input>
          </el-form-item>
          <el-form-item label="数据值:" style="display: inline-block; vertical-align: middle" prop="dictionaryEntriesPrice">
            <el-input v-model="insertDictionaryEntries.dictionaryEntriesPrice" ></el-input>
          </el-form-item>
          <el-form-item label="标签名:" style="display: inline-block; vertical-align: middle" prop="dictionaryEntriesName">
            <el-input v-model="insertDictionaryEntries.dictionaryEntriesName" ></el-input>
          </el-form-item>
          <el-form-item label="描述:" style="display: inline-block; vertical-align: middle" prop="dictionaryEntriesDescribe">
            <el-input v-model="insertDictionaryEntries.dictionaryEntriesDescribe" ></el-input>
          </el-form-item>
          <el-form-item label="排序:" style="display: inline-block; vertical-align: middle" prop="dictionaryEntriesSort">
            <el-input-number v-model="insertDictionaryEntries.dictionaryEntriesSort" controls-position="right" :min="1" :max="sort"></el-input-number>
          </el-form-item>
          <el-form-item label="数据类型:" style="display: inline-block; vertical-align: middle" prop="dictionaryEntriesTypeId">
            <el-select v-model="insertDictionaryEntries.dictionaryEntriesTypeId" placeholder="字典类型" style="width: 200px">
              <el-option v-for="item in dictionaryEntriesTypeList" :key="item.id" :label="item.dictionaryEntriesTypeName" :value="item.id"> </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="备注消息:" style="display: inline-block; vertical-align: middle">
            <el-input v-model="insertDictionaryEntries.dictionaryEntriesRemarks" ></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="emptyDictionaryEntries">取 消</el-button>
          <el-button type="primary" @click="dictionaryEntriesInsert">确 定</el-button>
        </div>
      </el-dialog>
      <!--修改字典项-->
      <el-dialog title="修改字典项" :visible.sync="revise" >
        <el-form :model="updateDictionaryEntries" ref="updateDictionaryEntries" :rules="rules" label-width="100px" style="text-align: left" class="demo-ruleForm">
          <el-form-item label="类型:" style="display: inline-block; vertical-align: middle" prop="dictionaryEntriesTypeEncoded">
            <el-input v-model="updateDictionaryEntries.dictionaryEntriesTypeEncoded" ></el-input>
          </el-form-item>
          <el-form-item label="数据值:" style="display: inline-block; vertical-align: middle" prop="dictionaryEntriesPrice">
            <el-input v-model="updateDictionaryEntries.dictionaryEntriesPrice" ></el-input>
          </el-form-item>
          <el-form-item label="标签名:" style="display: inline-block; vertical-align: middle" prop="dictionaryEntriesName">
            <el-input v-model="updateDictionaryEntries.dictionaryEntriesName" ></el-input>
          </el-form-item>
          <el-form-item label="描述:" style="display: inline-block; vertical-align: middle" prop="dictionaryEntriesDescribe">
            <el-input v-model="updateDictionaryEntries.dictionaryEntriesDescribe" ></el-input>
          </el-form-item>
          <el-form-item label="排序:" style="display: inline-block; vertical-align: middle" prop="dictionaryEntriesSort">
            <el-input-number v-model="updateDictionaryEntries.dictionaryEntriesSort" controls-position="right" :min="1" :max="updateSort"></el-input-number>
          </el-form-item>
          <el-form-item label="数据类型:" style="display: inline-block; vertical-align: middle" prop="dictionaryEntriesTypeId">
            <el-select v-model="updateDictionaryEntries.dictionaryEntriesTypeId" placeholder="字典类型" style="width: 200px">
              <el-option v-for="item in dictionaryEntriesTypeList" :key="item.id" :label="item.dictionaryEntriesTypeName" :value="item.id"> </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="备注消息:" style="display: inline-block; vertical-align: middle">
            <el-input v-model="updateDictionaryEntries.dictionaryEntriesRemarks" ></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="emptyRevise">取 消</el-button>
          <el-button type="primary" @click="dictionaryEntriesUpdate">确 定</el-button>
        </div>
      </el-dialog>

    </div>
  </div>
</template>

<script>
export default {
  created() {
    /*字典列表方法*/
    this.dictionarySelectAll();
    /*字典类型列表方法*/
    this.dictionaryTypeSelectAll();
    /*字典项数据类型列表方法*/
    this.dictionaryEntriesTypeSelectAll();
  },
  data () {
    return {
      value: '',
      dictionarySearch: {
        dictionaryTypeEncoded: '',
        dictionaryTypeId: null
      },
      update:false,
      revise:false,
      updateDictionary:{
        id:null,
        dictionaryTypeEncoded:'',
        dictionaryDescribe:'',
        dictionaryTypeId:null,
        dictionaryRemarks:'',
        dictionaryCreateTime:null,
        dictionaryDelFlag:0
      },
      page: {
        total: 0, // 数据总条数
        pageNum: 1, // 当前页
        pageSize: 5 // 每页条数
      },
      page1: {
        total: 0, // 数据总条数
        pageNum: 1, // 当前页
        pageSize: 5 // 每页条数
      },
      updateDictionaryEntries:{
        id:null,
        dictionaryEntriesTypeEncoded:'',
        dictionaryEntriesPrice:'',
        dictionaryEntriesName:'',
        dictionaryEntriesDescribe:'',
        dictionaryEntriesSort:1,
        dictionaryEntriesTypeId:null,
        dictionaryEntriesRemarks:'',
        dictionaryId:null,
        dictionaryEntriesDelFlag:0
      },
      addDictionary:false,//控制字典添加弹窗窗口
      addDictionaryEntries:false,
      insertDictionary:{
        dictionaryTypeEncoded:'',
        dictionaryDescribe:'',
        dictionaryTypeId:null,
        dictionaryRemarks:'',
      },
      insertDictionaryEntries:{
        dictionaryEntriesTypeEncoded:'',
        dictionaryEntriesPrice:'',
        dictionaryEntriesName:'',
        dictionaryEntriesDescribe:'',
        dictionaryEntriesSort:1,
        dictionaryEntriesTypeId:null,
        dictionaryEntriesRemarks:'',
        dictionaryId:null
      },
      dictionaryEntries:false,
      dictionaryList:null,
      dictionaryTypeList:null,
      dictionaryEntriesList:null,
      dictionaryEntriesTypeList:null,
      id:null,
      sort:null,
      updateSort:null,
      rules: {
        dictionaryTypeEncoded:[
          { required: true, message: '请输入类型', trigger: 'blur' },
          { min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur' }
        ],
        dictionaryDescribe:[
          { required: true, message: '请输入描述', trigger: 'blur' },
          { min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur' }
        ],
        dictionaryTypeId:[
          { required: true, message: '请选择字典类型', trigger: 'change' }
        ],
        dictionaryEntriesTypeEncoded:[
          { required: true, message: '请输入类型', trigger: 'blur' },
          { min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur' }
        ],
        dictionaryEntriesPrice:[
          { required: true, message: '请输入数据值', trigger: 'blur' },
          { min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur' }
        ],
        dictionaryEntriesName:[
          { required: true, message: '请输入标签名', trigger: 'blur' },
          { min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur' }
        ],
        dictionaryEntriesDescribe:[
          { required: true, message: '请输入描述', trigger: 'blur' },
          { min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur' }
        ],
        dictionaryEntriesSort:[
          { required: true, message: '请选择排序', trigger: 'change' }
        ],
        dictionaryEntriesTypeId:[
          { required: true, message: '请选择数据类型', trigger: 'change' }
        ]
      },
      screen:1
    }
  },
  methods: {
    /*字典列表方法*/
    dictionarySelectAll(){
      this.$axios.get('/dictionary/dictionarySelectAll', {
        params: {
          pageNum: this.page.pageNum,
          pageSize: this.page.pageSize
        }
      }).then((res) => {
        this.page.total=res.data.obj.total
        this.dictionaryList = res.data.obj.content;
      })
    },
    /*字典类型列表方法*/
    dictionaryTypeSelectAll(){
      this.$axios.get('/dictionary/dictionaryTypeSelectAll')
        .then((res) => {
          this.dictionaryTypeList = res.data.obj;
        })
    },
    /*条件搜索*/
    search(){
      this.$axios.post('/dictionary/fuzzySelectAll',this.dictionarySearch)
        .then((res) => {
          this.dictionaryList = res.data.obj;
        })
    },
    /*字典修改弹窗赋值方法*/
    openUpdate(row){
      if(row.dictionaryEntriesSort!=null) {
        this.updateDictionaryEntries.id =row.id
        this.updateDictionaryEntries.dictionaryEntriesTypeEncoded =row.dictionaryEntriesTypeEncoded
        this.updateDictionaryEntries.dictionaryEntriesPrice =row.dictionaryEntriesPrice
        this.updateDictionaryEntries.dictionaryEntriesName =row.dictionaryEntriesName
        this.updateDictionaryEntries.dictionaryEntriesDescribe =row.dictionaryEntriesDescribe
        this.updateDictionaryEntries.dictionaryEntriesSort =row.dictionaryEntriesSort
        this.updateDictionaryEntries.dictionaryEntriesTypeId =row.dictionaryEntriesTypeId
        this.updateDictionaryEntries.dictionaryEntriesRemarks =row.dictionaryEntriesRemarks
        this.updateDictionaryEntries.dictionaryId =row.dictionaryId
        this.updateDictionaryEntries.dictionaryEntriesDelFlag =row.dictionaryEntriesDelFlag
        this.revise=true
      }else {
        this.updateDictionary.id = row.id
        this.updateDictionary.dictionaryTypeEncoded = row.dictionaryTypeEncoded
        this.updateDictionary.dictionaryDescribe = row.dictionaryDescribe
        this.updateDictionary.dictionaryTypeId = row.dictionaryTypeId
        this.updateDictionary.dictionaryRemarks = row.dictionaryRemarks
        this.updateDictionary.dictionaryCreateTime = row.dictionaryCreateTime
        this.updateDictionary.dictionaryDelFlag = row.dictionaryDelFlag
        this.update = true
      }
    },
    /*搜索栏重置按钮*/
    resetting(){
      this.dictionarySearch.dictionaryTypeEncoded=''
      this.dictionarySearch.dictionaryTypeId=null
    },
    /*字典删除方法*/
    open(row) {
      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        if(row.dictionaryEntriesSort!=null){
          this.$axios.post('/dictionaryEntries/dictionaryEntriesDel',row)
            .then((res) => {
              this.$axios.get('/dictionaryEntries/dictionaryEntriesSelectAll/'+row.dictionaryId)
                .then((res) => {
                  this.dictionaryEntriesList = res.data.obj;
                })
            })
        }else{
          console.log(row.id)
          this.$axios.post('/dictionary/dictionaryDel/'+row.id)
            .then((res) => {
              this.dictionarySelectAll()
            })
        }
        this.$message({
          type: 'success',
          message: '删除成功!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    /*清空新增字典弹窗*/
    emptyDictionary(){
      this.$refs.insertDictionary.resetFields();
      this.addDictionary=false
    },
    /*新增字典*/
    dictionaryInsert(){
      this.$refs.insertDictionary.validate((valid) => {
        if (valid) {
          this.$axios.post('/dictionary/dictionaryInsert',this.insertDictionary)
            .then((res) => {
              this.$refs.insertDictionary.resetFields();
              this.addDictionary=false
              this.dictionarySelectAll()
            })
        } else {
          console.log('没通过验证');
          return false;
        }
      });
    },
    /*清空字典修改弹窗*/
    emptyUpdate(){
      this.$refs.updateDictionary.resetFields();
      this.update=false
    },
    /*字典修改方法*/
    dictionaryUpdate(){
      this.$refs.updateDictionary.validate((valid) => {
        if (valid) {
          this.$axios.post('/dictionary/dictionaryUpdate',this.updateDictionary)
            .then((res) => {
              this.dictionarySelectAll()
              this.$refs.updateDictionary.resetFields();
              this.update=false
            })
        } else {
          console.log('没通过验证');
          return false;
        }
      });
    },
    /*获取字典项*/
    dictionaryEntriesSelectAll(row){
      this.id=row.id
      this.dictionaryEntries=true
      this.$axios.get('/dictionaryEntries/dictionaryEntriesSelectAll', {
        params: {
          id:row.id,
          pageNum: this.page1.pageNum,
          pageSize: this.page1.pageSize
        }
      }).then((res) => {
        this.page1.total=res.data.obj.total
        this.dictionaryEntriesList = res.data.obj.content;
        this.$axios.get('/dictionaryEntries/sort/'+row.id)
          .then((res) => {
            this.sort=res.data.obj
            this.updateSort=this.sort-1
          })
      })
    },
    /*获取字典项*/
    dictionaryEntriesSelectAll1(){
      this.$axios.get('/dictionaryEntries/dictionaryEntriesSelectAll', {
        params: {
          id:this.id,
          pageNum: this.page1.pageNum,
          pageSize: this.page1.pageSize
        }
      }).then((res) => {
        this.page1.total=res.data.obj.total
        this.dictionaryEntriesList = res.data.obj.content;
        this.$axios.get('/dictionaryEntries/sort/'+this.id)
          .then((res) => {
            this.sort=res.data.obj
            this.updateSort=this.sort-1
          })
      })
    },
    /*获取字典项数据类型列表*/
    dictionaryEntriesTypeSelectAll(){
      this.$axios.post('/dictionaryEntries/dictionaryEntriesTypeSelectAll')
        .then((res) => {
          this.dictionaryEntriesTypeList = res.data.obj;
        })
    },
    /*清空新增字典项弹窗*/
    emptyDictionaryEntries(){
      this.$refs.insertDictionaryEntries.resetFields();
      this.addDictionaryEntries=false
    },
    /*新增字典项弹窗*/
    dictionaryEntriesInsert(){
      this.$refs.insertDictionaryEntries.validate((valid) => {
        if (valid) {
          this.insertDictionaryEntries.dictionaryId=this.id
          this.$axios.post('/dictionaryEntries/dictionaryEntriesInsert',this.insertDictionaryEntries)
            .then((res) => {
              this.dictionaryEntriesSelectAll1()
              this.$refs.insertDictionaryEntries.resetFields();
              this.addDictionaryEntries=false
            })
        } else {
          console.log('没通过验证');
          return false;
        }
      });
    },
    /*清空修改字典项弹窗*/
    emptyRevise(){
      this.$refs.updateDictionaryEntries.resetFields();
      this.revise=false
    },
    /*修改字典项*/
    dictionaryEntriesUpdate(){
      this.$refs.updateDictionaryEntries.validate((valid) => {
        if (valid) {
          this.$axios.post('/dictionaryEntries/dictionaryEntriesUpdate',this.updateDictionaryEntries)
            .then((res) => {
              this.dictionaryEntriesSelectAll1()
              this.$refs.updateDictionaryEntries.resetFields();
              this.revise=false
            })
        } else {
          console.log('没通过验证');
          return false;
        }
      });
    },
    handleSizeChange (val) {
      this.page.pageSize = val
      this.dictionarySelectAll()
    },
    handleCurrentChange (val) {
      this.page.pageNum = val
      this.dictionarySelectAll()
    },
    handleSizeChange1 (val) {
      this.page1.pageSize = val
      this.dictionaryEntriesSelectAll1()
    },
    handleCurrentChange1 (val) {
      this.page1.pageNum = val
      this.dictionaryEntriesSelectAll1()
    },
    F5 () {
      location. reload();
    },
  }
}

</script>

<style scoped>
.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both;
}

.box-card {
  width: 480px;
}
.el-pagination.is-background .btn-next,
.el-pagination.is-background .btn-prev,
.el-pagination.is-background .el-pager li {
  font-size: 12px;
  color: #999999;
  font-weight: 400;
  border-width: 1px;
  border-style: solid;
  border-color: rgba(228, 228, 228, 1);
  background-color: #fff;
}
.el-pagination.is-background .el-pager li:not(.disabled).active {
  /**分页被选中的背景颜色 */
  background-color: #d7000f;
}
.el-pagination.is-background .el-pager li:not(.disabled):hover {
  /**分页 鼠标移入被 选中的字体颜色 */
  color: #d7000f;
}
.el-button--primary {
  /**修改实名认证页面 确定按钮 */
  color: #fff;
  background-color: #d7000f;
  border-color: #d7000f;
}
.el-button--primary:focus,
.el-button--primary:hover {
  /**修改实名认证页面 确定按钮 */
  background: #e96a72;
  border-color: #e96a72;
  color: #fff;
}
.el-input.is-active .el-input__inner,
.el-input__inner:focus {
  /**页面 最上方 输入框 */
  border-color: #d7000f;
}
.el-range-editor.is-active,
.el-range-editor.is-active:hover,
.el-select .el-input.is-focus .el-input__inner {
  /**页面 最上方 选择框 */
  border-color: #d7000f;
}
.el-select-dropdown__item.selected {
  /**页面 最上方 选择框 中被选中的选项 */
  color: #d7000f;
}
.el-select .el-input__inner:focus {
  /**页面 最上方 选择框 */
  border-color: #d7000f;
}
/**图片上传 */
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
.el-radio__input.is-checked .el-radio__inner {
  /** 修改 用户信息 单选框 */
  border-color: #d7000f;
  background: #d7000f;
}
.el-radio__input.is-checked + .el-radio__label {
  /** 修改 用户信息 单选框 文字 */
  color: #d7000f;
}
.el-radio__inner:hover {
  /** 修改 用户信息 单选框 */
  border-color: #d7000f;
}
.el-button:focus,
.el-button:hover {
  /**取消修改*/
  color: #d7000f;
  border-color: #c07676;
  background-color: #ffecec;
}
.avatar-uploader-icon {
  /**图片上传*/
  line-height: 40px;
}
.avatar-uploader .el-upload:hover {
  /**图片上传*/
  border-color: #d7000f;
}
.userAvatarLook .el-descriptions-row:last-child {
  /**查看  图片*/
  height: 90px;
}
.userAvatarLook
.el-descriptions-row:last-child
.el-descriptions-item__cell:last-child {
  /**查看  图片*/
  height: 90px;
}
.el-dialog-div {
  height: 92px;
  overflow-x: hidden;
}
</style>
